﻿using UnityEngine;
using System.Collections;

[USequencerEvent("序列/播放序列")]
public class USPlaySequenceEvent : USEventBase 
{
	public USSequencer sequence = null;
	public bool restartSequencer = false;
	
	public override void FireEvent()
	{	
		if(!sequence)
		{
            Debug.LogWarning("参数没有设定USSequencer组件 : " + name, this);
			return;
		}
		
		if(!Application.isPlaying)
		{
			Debug.LogWarning("编辑状态下不支持序列播放.");
			return;
		}
		
		if(!restartSequencer)
		{
			sequence.Play();
		}
		else
		{
			sequence.RunningTime = 0.0f;
			sequence.Play();
		}
	}
	
	public override void ProcessEvent(float deltaTime)
	{
		
	}
}
